<?php
require_once 'Service/Condition.php';

/**
 * String field contains substring.
 *
 * @author baziak
 */
class Service_Condition_ZendDb_StringContains extends Service_Condition
{
    protected $_operator = 'LIKE';

    public function __toString()
    {
        $db = $this->getDataSource()->getAdapter();

        $value = $db->quote('%' . $this->_params['value'] . '%');
        
        $field = $db->quoteIdentifier($this->_params['field']);

        return $field .' '. $this->_operator .' '. $value;
    }
}
